package com.tedu._04mybatis.mapper;

import com.tedu._04mybatis.pojo.Article;
import com.tedu._04mybatis.pojo.ArticleVO1;
import com.tedu._04mybatis.pojo.ArticleVO2;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ArticleMapper {
//    @Insert("INSERT INTO article(content,created,user_id) " +
//            "VALUES (#{content},#{created},#{userId})")
    int insertArticle(Article article);

//    @Delete("DELETE FROM article WHERE id = #{id}")
    int deleteArticleById(Integer id);

//    @Update("UPDATE article " +
//            "SET content = #{content},created = #{created},user_id = #{userId} " +
//            "WHERE id = #{id}")
    int updateArticleById(Article article);

//    @Select("SELECT id,content,created,user_id userID " +
//            "FROM article " +
//            "WHERE id = #{id}")
    Article selectArticleById(Integer id);

//    @Select("SELECT id,content,created,user_id userID " +
//            "FROM article")
    List<Article> selectAllArticle();

//    @Select("SELECT content,created " +
//            "FROM article " +
//            "WHERE id = #{id}")
    ArticleVO1 selectArticleByIdVO1(Integer id);

//    @Select("SELECT content,created,user_id userID " +
//            "FROM article")
    List<ArticleVO2> selectArticleByIdVO2();

    int dynamicUpdateArticle(Article article);

    int dynamicDeleteArticle(Integer[] ids);
}
